package cn.itrip.biz.controller;

import cn.itrip.beans.dtos.Dto;
import cn.itrip.beans.vo.AreaDicVo;
import cn.itrip.common.DtoUtils;
import cn.itrip.biz.service.HoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/hotel")
@Api
public class HoteController {
    @Resource
    private HoteService hoteService;
    /****
     * 查询热门城市的接口
     *
     * @param isChina
     * @return
     * @throws Exception
     */
    @ApiOperation(value = "查询热门城市", httpMethod = "GET",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class, notes = "查询国内、国外的热门城市(1:国内 2:国外)" +
            "<p>成功：success = ‘true’ | 失败：success = ‘false’ 并返回错误码，如下：</p>" +
            "<p>错误码：</p>" +
            "<p>10201 : hotelId不能为空 </p>" +
            "<p>10202 : 系统异常,获取失败</p>")
    @GetMapping("/queryhotcity/{isChina}")
    public Dto queryhotcity(
            @ApiParam(required = true,value = "1国内，2国外",name = "isChina")
            @PathVariable  Integer isChina){
        return DtoUtils.returnDataSuccess(hoteService.queryhotcity(isChina));
    }
    @GetMapping("/querytradearea/{parentId}")
    public Dto querytradearea(@PathVariable Integer parentId){
       List<AreaDicVo> list = hoteService.querytradearea(parentId);
       return DtoUtils.returnDataSuccess(list);
    }
}
